// 递归处理
package composite

type IOrderFeeCal interface {
	GetMoney() int
}

type CompositeFee struct {
	total int
	Comp  []IOrderFeeCal
}

func (cf CompositeFee) GetMoney() int {
	for _, v := range cf.Comp {
		cf.total += v.GetMoney()
	}
	return cf.total
}

type PayOrderFeeCal struct {
	payFee int
}

func (pof PayOrderFeeCal) GetMoney() int {
	return pof.payFee * 2
}

type StockOrderFeeCal struct {
	stockFee int
}

func (sof StockOrderFeeCal) GetMoney() int {
	return sof.stockFee
}
